using System;
using System.Data;

using Wicresoft.Common;

namespace Wicresoft.Messages.Entity
{
	[Table("UserTimeRule", "", "Wicresoft.Messages.ConnectionString")]
	public class UserTimeRule : Info
	{
		#region SQL column name consts 
		public const string SQLCOL_USERTIMERULEID = "UserTimeRuleID";
		public const string SQLCOL_USERNAME = "UserName";
		public const string SQLCOL_DEVICEID = "DeviceID";
		public const string SQLCOL_STARTTIME = "StartTime";
		public const string SQLCOL_ENDTIME = "EndTime";
		#endregion


		#region Contructors
		/// <summary>
		/// Construct empty entity
		/// </summary>
		public UserTimeRule () {}

		/// <summary>
		/// Construct entity by primary key, other fields will be assigned by 
		/// "Load" method.
		/// </summary>
		public UserTimeRule (Guid UserTimeRuleID)
		{
			this.UserTimeRuleID = UserTimeRuleID;
		}
		#endregion

		public override void Init (DataRow row)
		{
			UserTimeRuleID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_USERTIMERULEID]);
			UserName = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_USERNAME]);
			DeviceID = (int)ObjectType.IntTypeHelper.Read(row[SQLCOL_DEVICEID]);
			StartTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_STARTTIME]);
			EndTime = (DateTime)ObjectType.DateTimeTypeHelper.Read(row[SQLCOL_ENDTIME]);
		}

		#region Properties 
		#region Property <Guid> UserTimeRuleID
		[Property("UserTimeRuleID", 16, SqlDbType.UniqueIdentifier, false, true)]
		public Guid UserTimeRuleID 
		{
			get { return _UserTimeRuleID; }
			set { _UserTimeRuleID = value; }
		}
		private Guid _UserTimeRuleID = Guid.Empty;
		#endregion

		#region Property <string> UserName
		[Property("UserName", 100, SqlDbType.NVarChar, false, false)]
		public string UserName 
		{
			get { return _UserName; }
			set { _UserName = value; }
		}
		private string _UserName = null;
		#endregion

		#region Property <int> DeviceID
		[Property("DeviceID", 4, SqlDbType.Int, false, false)]
		public int DeviceID 
		{
			get { return _DeviceID; }
			set { _DeviceID = value; }
		}
		private int _DeviceID = int.MinValue;
		#endregion

		#region Property <DateTime> StartTime
		[Property("StartTime", 16, SqlDbType.DateTime, false, false)]
		public DateTime StartTime 
		{
			get { return _StartTime; }
			set { _StartTime = value; }
		}
		private DateTime _StartTime = DateTime.MinValue;
		#endregion

		#region Property <DateTime> EndTime
		[Property("EndTime", 16, SqlDbType.DateTime, false, false)]
		public DateTime EndTime 
		{
			get { return _EndTime; }
			set { _EndTime = value; }
		}
		private DateTime _EndTime = DateTime.MinValue;
		#endregion
		#endregion




	}
}
